package com.jeomo.mem.starter.mapper;

import com.jeomo.base.starter.mapper.IBaseMapper;
import com.jeomo.mem.starter.entity.MemIndexEntity;
import com.jeomo.mem.starter.entity.Member;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 会员表 Mapper 接口
 *
 * @author Jackpot
 * @since 2020-10-22
 */
@Mapper
public interface MemberMapper extends IBaseMapper<Member> {

    /**根据会员号查询会员信息*/
    //selectById()

    /**
     * 根据顶级组织号和手机号查询会员基本信息
     *
     * @param topOrg
     * @param phone
     * @return
     */
    @Select("SELECT * FROM member WHERE top_org_code = #{topOrg} AND member_phone = #{phone} limit 1")
    Member queryMemberByPhone(@Param("topOrg") String topOrg, @Param("phone") String phone);

    /** 新增会员 */
    //insert()

    /**
     * 修改会员
     */
    //updateById()

    int queryDayCountRegister(String date);

    /**
     * 截止到某天的当天的注册量
     */
    int queryOneDayCountRegister(String date);

    /**
     * @param
     * @description: 获取某日每小时注册量
     * @return:
     * @author: 崔贺
     * @time: 2020/11/19 10:32
     */
    List<MemIndexEntity> queryHourlyRegister(String date);

    /**
     * @param dateFrom 从某天开始
     * @param dateTo   从某天结束
     * @description:
     * @return: java.util.List<com.jeomo.mem.starter.entity.MemIndexEntity>
     * @author: 崔贺
     * @time: 2020/11/20 14:40
     */
    List<MemIndexEntity> queryDateRegister(@Param("dateFrom") String dateFrom, @Param("dateTo") String dateTo, @Param("status") int status);
}
